/**
 * Created by GadflyBSD on 16/4/18.
 */
var meta = new Object();
var content = document.getElementsByTagName('meta');
for(var i = 0; i < content.length; i++){
	if(content[i].getAttribute('name') == 'Authcode')
		meta.appurl = content[i].getAttribute('content');
	if(content[i].getAttribute('name') == 'appurl')
		meta.verifyImg = content[i].getAttribute('content');
	if(content[i].getAttribute('name') == 'upload')
		meta.upload = content[i].getAttribute('content');
	if(content[i].getAttribute('name') == 'angular')
		meta.angular = content[i].getAttribute('content');
	if(content[i].getAttribute('name') == 'appId')
		meta.appId = content[i].getAttribute('content');
	if(content[i].getAttribute('name') == 'timestamp')
		meta.timestamp = content[i].getAttribute('content');
	if(content[i].getAttribute('name') == 'nonceStr')
		meta.nonceStr = content[i].getAttribute('content');
	if(content[i].getAttribute('name') == 'signature')
		meta.signature = content[i].getAttribute('content');
}
wx.config({
	debug: false,
	appId: meta.appId,
	timestamp: meta.timestamp,
	nonceStr: meta.nonceStr,
	signature: meta.signature,
	jsApiList: ['closeWindow']
});
function closeWindows(){
	$('#dialog_alert').hide();
	wx.ready(function(){
		wx.closeWindow();
	});
}
angular.module('myApp', ['myApp.controllers', 'myApp.services']);
angular.module('myApp.services', [])
	.factory('myService', function($http){
		return {
			orderStatus: function(uuid, status){
				"设置用户详细数据";
				return $http({
					url: meta.angular,
					method: 'post',
					data: {ac: 'onePagePost', op: 'setOrderStatus', uuid: uuid, status: status}
				});
			}
		};
	});
angular.module('myApp.controllers', [])
	.controller('confirmCtrl', function($scope, $http, myService){
		$scope.orderStatus = function(uuid, status){
			$('#loading_toast').show();
			myService.orderStatus(uuid, status).success(function(resp){
				$('#dialog_content').text(resp.content);
				$('#loading_toast').hide();
				$('#dialog_alert').show();
			});
		}
	})